package chapter02;

public class test {
    public static <g> void main(String[] args) {
        String str1 = "abc";
        String str2 = new String("123");




        System.out.println(str1 == str2); //False
        System.out.println(str1.equals(str2)); //True

        System.out.println(str1.hashCode());
        System.out.println(str2.hashCode());
        System.out.println();

/*

更多思考：是否八大基本数据类型也是这个机制：只要看上去是一样的。地址就相等
int a = 1;
Integer b = 1;

System.out.println(a == b);

double c = 1.0;
Double d = 1.0;

System.out.println(c == d);

*/


        System.out.println(str1.charAt(0));

        System.out.println(str1.concat(str2));


        String str3 = "1s3";
        System.out.println(str3.length());

        System.out.println(34/32);


        //31
        byte b1=2;
        b1 = (byte) (b1 +2);

        //测试数字和字符是否一次定义就不变地址

        int a1 = 1;
        int a2 = 1;
        System.out.println(a1 == a2);

        int a3  = a2;
        System.out.println(a3 == a2);

        //结果表示确实如此

        //追问一下，如果我强制添一个地址呢？
//        Integer intObj = new Integer(4);
        Integer intObj = 1;  // 自动装箱
        Integer intObj1 = Integer.valueOf(1);  // 推荐方式
        System.out.println(intObj == a1);
        System.out.println(intObj1 == a1);
        //结果依然正确


        //常量

        final int i =1;
//        i = 2;
        System.out.println(i);

        //变量赋值

        int x,y = 1;




    }
}
